#pragma once

#include "DeploymentTarget.h"

#include "Deployment.h"
#include "PackageableElement.h"

namespace uml {

void DeploymentTarget::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    PartialElement::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(deployedElements_, "deployedElements", json, errorList);
    JsonSerializable::fromJsonArray(deployments_, "deployments", json, errorList);
}

void DeploymentTarget::toJson(QJsonObject& json) {
    PartialElement::toJson(json);
    JsonSerializable::toJsonArray(deployedElements_, "deployedElements", json);
    JsonSerializable::toJsonArray(deployments_, "deployments", json);
}

/// <summary>
/// deployedElements getter
/// The set of elements that are manifested in an Artifact that is involved in
/// Deployment to a DeploymentTarget.
/// </summary>
vector<shared_ptr<PackageableElement>>& DeploymentTarget::deployedElements() {
    return deployedElements_;
}

/// <summary>
/// deployments getter
/// The set of Deployments for a DeploymentTarget.
/// </summary>
vector<shared_ptr<Deployment>>& DeploymentTarget::deployments() {
    return deployments_;
}

} // namespace uml
